package com.jgjc.service.serviceImpl;

import com.jgjc.dao.BasicInfoDao;
import com.jgjc.service.BasicInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class BasicInfoServiceImpl implements BasicInfoService {

    @Resource
    private BasicInfoDao basicInfoDao;

    @Override
    public List<Map<String, Object>> isBridgeExists(Map<String, Object> isBridgeExistMap) {
        return basicInfoDao.isBridgeExists(isBridgeExistMap);
    }

    @Override
    public int addBasicInfo(Map<Object, Object> infoMap) {
        return basicInfoDao.addBasicInfo(infoMap);
    }

    @Override
    public List<Map<String, Object>> getAllBasicInfo(String name) {
        List<Map<String, Object>> mapList = basicInfoDao.getAllBasicInfo(name);
        if (mapList.size() > 0) {
            for (int i = 0; i < mapList.size(); i++) {
                if (null == mapList.get(i).get("sideCount") || "".equals(mapList.get(i).get("sideCount"))) {
                    mapList.get(i).put("sideCount", 0);
                }
            }
        }
        return mapList;
    }

    @Override
    public int deleteBridge(int bridgeId, int deleteReasonId) {
        return basicInfoDao.deleteBridge(bridgeId, deleteReasonId);
    }

    @Override
    public List<Map<String, Object>> getDeleteStatusList() {
        return basicInfoDao.getDeleteStatusList();
    }

    @Override
    public List<Map<String, Object>> getDeckDivideTypeList() {
        return basicInfoDao.getDeckDivideTypeList();
    }

    @Override
    public List<Map<String, Object>> getCrossTypeList() {
        return basicInfoDao.getCrossTypeList();
    }

    @Override
    public List<Map<String, Object>> getBridgeCategoryList() {
        return basicInfoDao.getBridgeCategoryList();
    }

    @Override
    public List<Map<String, Object>> getLoadCapacityList() {
        return basicInfoDao.getLoadCapacityList();
    }

    @Override
    public List<Map<String, Object>> getDesignLoadList() {
        return basicInfoDao.getDesignLoadList();
    }

    @Override
    public List<Map<String, Object>> getFunctionTypeList() {
        return basicInfoDao.getFunctionTypeList();
    }

    @Override
    public List<Map<String, Object>> getRoadLevelList() {
        return basicInfoDao.getRoadLevelList();
    }

    @Override
    public List<Map<String, Object>> getRoadNoList() {
        return basicInfoDao.getRoadNoList();
    }

    @Override
    public int updateBasicInfo(Map<Object, Object> infoMap) {
        return basicInfoDao.updateBasicInfo(infoMap);
    }
}
